package com.orderplus.opshop.core.constants.enums;


import lombok.Getter;

/**
 * AppName + ChannelCode + 错误类别 + 4位错误码 = IPRES03000000
 * 外部响应编码
 * 转换：交易成功00、交易失败01、交易处理中02、交易超时03、校验异常04 未知：系统异常05
 */
public enum ResponseCodeConstant {

	//******** 成功(00) ********
	SUCCESS("200", "成功"),

	FAILED("500", "失败"),

	FAILED_OPERATION("1000", "操作失败"),

	//******** 失败(01) ********
	FAILED_ORDER("10001", "下单失败"),

	//******** 处理中(02) ********,
	PROCESSING("20001", "交易处理中"),

	//******** 超时(03) ********
	UNKNOWN_EXCEPTION("30001", "网络未知异常"),
	NETWORK_EXCEPTION("30002", "网络异常"),
	TIME_OUT("30003", "请求超时"),
	BIZ_EXCEPTION("30004", "业务异常"),
	FORBIDDEN_EXCEPTION("30005", "网络禁止"),
	SERIALIZATION_EXCEPTION("30006", "网络序列化异常"),

	//******** 校验异常(04) ********
	//请求参数校验
	REQUEST_ILLEGAL("40001", "请求参数非法"),
	REQUEST_VALID("40002", "请求参数合法"),

	//******** 系统异常(05) ********
	SYS_EXCEPTION("50001", "系统异常"),
	REMOTE_RESPONSE_NULL_EXCEPTION("50002", "系统异常，请确认请求是否成功再尝试发起"),
	OBJECT_CONVERT_FAILED("50003", "对象格式转换失败"),
	DB_EXCEPTION("50004", "数据库异常"),


	//权限校验
	ROLE_ILLEGAL("60001", "非法权限"),
	ROLE_VALID("60002", "通过权限验证"),
	LOGIN_ILLEGAL("60001", "非法登陆"),
	LOGIN_VALID("60002", "登陆验证通过"),
	;

	/**
	 * 定义常量
	 */
	@Getter
	private final String responseCode;

	@Getter
	private final String responseDesc;


	ResponseCodeConstant(String responseCode, String responseDesc) {
		this.responseCode = responseCode;
		this.responseDesc = responseDesc;
	}


}
